.data
	inputs: .space 400
	prompt: .asciiz "Please enter an integer. Enter -1 to display array in reverse.\n"
	continue: .asciiz "\nDo you wish to put in more values. Enter 1 for yes, 0 for no.\n"
	comma:  .asciiz ","
	Goodbye: .asciiz "Goodbye.\n"
.text

	main:
li $t1,0
Beg: 
	li $t0,0
	Loop:
		beq $t0,-1, ExitLoop

		la $a0,prompt
		li $v0, 4
		syscall

		li $v0, 5
		syscall
		addi $t0,$v0,0

		sw $t0, inputs($t1)
		addi $t1, $0, 4


		j Loop
	ExitLoop: 
		addi $t3, $t1,-4
	
	Print:
		beq $t3,-4, Exit

		lw $a0,inputs($t3)
		li $v0,1
		syscall

		la $a0,comma
		li $v0,4
		syscall

		addi $t3,$0,-4

		j Print
	Exit:
		la $a0, continue
		li $v0,4
		syscall

		li $v0,5
		syscall
		addi $t5,$v0,0

		If:
			beq $t5,0,Quit
			li $t0,0
			j Beg
		Quit:
			la $a0,Goodbye
			li $v0,4
			syscall
		
			li $v0,10
			syscall